1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module soup.AuthManager;
26 
27 private import gobject.ObjectG;
28 private import gobject.Signals;
29 private import soup.Auth;
30 private import soup.Message;
31 private import soup.SessionFeatureIF;
32 private import soup.SessionFeatureT;
33 private import soup.URI;
34 private import soup.c.functions;
35 public  import soup.c.types;
36 private import std.algorithm;
37 
38 
39 /** */
40 public class AuthManager : ObjectG, SessionFeatureIF
41 {
42 	/** the main Gtk struct */
43 	protected SoupAuthManager* soupAuthManager;
44 
45 	/** Get the main Gtk struct */
46 	public SoupAuthManager* getAuthManagerStruct(bool transferOwnership = false)
47 	{
48 		if (transferOwnership)
49 			ownedRef = false;
50 		return soupAuthManager;
51 	}
52 
53 	/** the main Gtk struct as a void* */
54 	protected override void* getStruct()
55 	{
56 		return cast(void*)soupAuthManager;
57 	}
58 
59 	/**
60 	 * Sets our main struct and passes it to the parent class.
61 	 */
62 	public this (SoupAuthManager* soupAuthManager, bool ownedRef = false)
63 	{
64 		this.soupAuthManager = soupAuthManager;
65 		super(cast(GObject*)soupAuthManager, ownedRef);
66 	}
67 
68 	// add the SessionFeature capabilities
69 	mixin SessionFeatureT!(SoupAuthManager);
70 
71 
72 	/** */
73 	public static GType getType()
74 	{
75 		return soup_auth_manager_get_type();
76 	}
77 
78 	/**
79 	 * Clear all credentials cached by @manager
80 	 *
81 	 * Since: 2.58
82 	 */
83 	public void clearCachedCredentials()
84 	{
85 		soup_auth_manager_clear_cached_credentials(soupAuthManager);
86 	}
87 
88 	/**
89 	 * Records that @auth is to be used under @uri, as though a
90 	 * WWW-Authenticate header had been received at that URI. This can be
91 	 * used to "preload" @manager's auth cache, to avoid an extra HTTP
92 	 * round trip in the case where you know ahead of time that a 401
93 	 * response will be returned.
94 	 *
95 	 * This is only useful for authentication types where the initial
96 	 * Authorization header does not depend on any additional information
97 	 * from the server. (Eg, Basic or NTLM, but not Digest.)
98 	 *
99 	 * Params:
100 	 *     uri = the #SoupURI under which @auth is to be used
101 	 *     auth = the #SoupAuth to use
102 	 *
103 	 * Since: 2.42
104 	 */
105 	public void useAuth(URI uri, Auth auth)
106 	{
107 		soup_auth_manager_use_auth(soupAuthManager, (uri is null) ? null : uri.getURIStruct(), (auth is null) ? null : auth.getAuthStruct());
108 	}
109 
110 	/**
111 	 * Emitted when the manager requires the application to
112 	 * provide authentication credentials.
113 	 *
114 	 * #SoupSession connects to this signal and emits its own
115 	 * #SoupSession::authenticate signal when it is emitted, so
116 	 * you shouldn't need to use this signal directly.
117 	 *
118 	 * Params:
119 	 *     msg = the #SoupMessage being sent
120 	 *     auth = the #SoupAuth to authenticate
121 	 *     retrying = %TRUE if this is the second (or later) attempt
122 	 */
123 	gulong addOnAuthenticate(void delegate(Message, Auth, bool, AuthManager) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
124 	{
125 		return Signals.connect(this, "authenticate", dlg, connectFlags ^ ConnectFlags.SWAPPED);
126 	}
127 }